<?php
error_reporting(E_ALL);
header("content-type:text/html;charset=utf-8");
//echo "hello world";
//echo 20%7,'</br>';
//$num=1;
// while ($num < 100) {
//     $num++;
//     if ($num%3==0) {
//         if ($num%5==0) {
//            echo "3和5的倍数</br>";
//         } else {
//             echo "3的倍数</br>";
//         }
//     }else if ($num%5==0) {
//         echo "5的倍数</br>";
//     } else{
//         echo $num,"</br>";
//     }
// }
//$str="dd666\nssssd";
//echo $str."</br>";
//print_r($_GET["啊啊"]);
if($_GET["id"]){
}else{
    if($_POST["name"]){   
        $fh= fopen("./1.txt","a");//打开文件
        $str=$_POST["name"].",".$_POST["content"]."\r\n";
        fwrite($fh,$str);
        fclose($fh);
    }  
}

$fh2= fopen("./1.txt","r");
$i=1;
while( ($types=fgetcsv($fh2)) != false){
    if($_GET["id"]){
        if($_GET["id"]==$i){
            echo $types[0],$types[1],"</br>";
        }
        $i++;
    }else{
        echo $types[0],$types[1],"</br>";
    }
    
    // print_r($types["name"]);
    // print_r($types["content"]);
}
fclose($fh2);

//echo "ok";